#include <iostream>
#include <signal.h>
#include <unistd.h>
using namespace std ;


size_t count  = 0 ;

void handler(int sinnum)
{
    cout << "捕捉到命令：" << sinnum <<"进行计算次数:" <<count  << endl ;
    count = 0 ;
    alarm(1);
}


int main()
{
    signal(SIGALRM,handler);
    alarm(1);
    while (true)
    {
        count++;
    }
    return 0 ;
}